1. Field of the Invention
The present invention relates to an image processing apparatus for processing a moving picture and a program for causing a computer to execute an image processing method and in particular, to a method for image gradation quantization and animation, region division processing, and object extraction processing.
2. Description of the Related Art
An image processing technique is used in various systems such as a monitoring system and a vehicle automatic operation system. Among them, the gradation quantization processing is a processing for reducing the number of levels of image component value associated with image color information (for example, pixel values of components of RGB and components of YUV) and reduce the number of colors in an image. For example, a full color image in which each of RGB is expressed in 256 gradations is reduced to about 10 gradations for each color. The gradation quantization processing is performed as a pre-stage of region dividing processing for dividing a region into regions each having similar colors in an object extraction processing for isolating a person, a vehicle, or the like from a picked up image.
Moreover, a digital camera and a video camera are widely spread in people. A user performs image processing for processing/editing an image picked up by a PC. It is expected to develop an animation technique for transforming a picked-up moving picture into an animation cell image and a technique for attaching a character, a symbol, and a picture onto the image or cut off a particular portion from an image and combine it with another image. In the moving picture animation technique, smoothing and contour detection/emphasis processing accuracy are dominant elements for image impression but the gradation quantization as the pre-stage is also important.
Furthermore, most of the recently developed mobile telephones have a built-in camera and can record a moving picture in real time. With such a sophisticated function, such a sophisticated application is expected that the picked up image is made into animation in real time or a commodity is imaged and information associated with it is collected from a network. In order to perform such a sophisticated image processing by a small-size device, it is necessary to develop a method capable of performing a basic processing such as gradation quantization at a higher speed and with a preferable final output result.
The conventional gradation quantization processing may be a method for multi-dimensional processing in a color component (image component space) or a method for processing for each image component. The multi-dimensional processing method may be, for example, a vector quantization method which is characterized in that the color reproduction after quantization can be improved. On the other hand, the method for processing for each image component may be a method for performing analysis by repetition processing, a method for performing division so as to obtain a constant histogram area, a method for dividing the image component level at a constant interval, or the like.
For example, the method using the repetition processing may be the K-average clustering method. Firstly, a reference value (level value after gradation quantization) is appropriately decided for each image component and while moving it with a constant width, a sum of an error with respect to the image component value (pixel value) is repeatedly calculated, so as to obtain the combination of the reference values to minimize the sum.
Furthermore, as a method for performing division to obtain a constant histogram area, there is a method to decide a reference value so that the area of the frequency histogram of the image component value is constant at each reference value periphery (for example, JP-A-10-164377).
Thus, there are several types of gradation quantization. For a still image, a method having a high accuracy although the processing speed is slow has been used. For a moving picture, a method for high-speed processing in spite of low accuracy has been used.
The vector quantization method has a problem that processing is complicated, requiring a plenty of time and cannot be applied to the real time processing of a moving picture. Moreover, the K-average clustering method also has a problem that a plenty if time is required like the multi-dimensional processing method and cannot be applied to a moving picture. Moreover, when this method is applied to the animation, there is a problem that since the reference value changes for each frame, the color an luminance change appear as flashing of the image, causing a flicker.
Moreover, the aforementioned method disclosed in JP-A-10-164377 does not consider the error between the reference value and the image component value and is valid to a certain extent when a histogram has one peak but the quality is significantly deteriorated in other cases. Moreover, in the same way as the aforementioned method, a flicker may be caused.
The method for dividing a level at a certain interval can perform a high-speed processing and since the reference value is constant for all the frames, no flicker is caused. However, this method does not answer to the image change and the color reproduction is not preferable. This method cannot be applied to animation and obstacle extraction where the number of gradation should be reduced to a small number.
As has been described above, there has been no gradation quantization which can perform a high-speed processing and maintain a high-quality of moving picture.